function text_win(fig_title_cell,x,y,axis_label_cell,legend_cell, ...
      descriptive_text_cell,done_flag)
%
% Function to create a graphics window for displaying
% graphs and text in a list box for the demo
%
% Input:
%   done_flag = optional, =1 to add a Close button to the screen

global demo_fig

if nargin<7,  % No done flag provided
  done_flag = 0;
end;

clf;
text_plot_fig=gcf;
colordef none;

ax=axes('position',[0.1 0.1 0.85 0.5]);
set(gca,'box','on');

hold on;
plot(x,y);
hold off;
if ~isempty(axis_label_cell(3,:)),
  title(axis_label_cell(3,:));
end;
if ~isempty(axis_label_cell(1,:)),
  xlabel(axis_label_cell(1,:));
end;
if ~isempty(axis_label_cell(2,:)),
  ylabel(axis_label_cell(2,:));
end;
if ~isempty(legend_cell),
  legend(char(legend_cell),0);
end;

fig_title = uicontrol(text_plot_fig,...
  'style','text',...
  'units','normalized',...
  'fontsize',18',...
  'fontweight','bold',...
  'horizontalalignment','left',...
  'string',fig_title_cell,...
  'backgroundcolor','black',...
  'foregroundcolor','white',...
  'position',[0.1 0.87 0.85 0.1]);

text_describe = uicontrol(text_plot_fig,...
  'style','listbox',...
  'units','normalized',...
  'backgroundcolor','white',...
  'fontsize',12,...
  'position',[0.1 0.65 0.85 0.25],...
  'string',descriptive_text_cell);

if done_flag==1,
  close_txt_win = uicontrol(text_plot_fig,...
  'style','push',...
  'units','normalized',...
  'backgroundcolor','white',...
  'fontsize',12,...
  'position',[0.80 0.925 0.15 0.05],...
  'string','Return to Main',...
  'CallBack',[ ...
    'close(text_plot_fig);',...
    'set(demo_fig(1),''visible'',''on'');']);
end;


